<div class="tales_stats_menu">
    <ui>
        <li class="tales_of_deonia"><?php echo __(LANG_USER_ACCOUNT_INPUT_INFORM)?></li>
    </ui>
</div>

<div class="tales_div_search_main">
    <?php echo $this->Form->create('search_user');?></div>
    <div class="input_div">
        <?php echo $this->Form->input('account', array(
            'style'=>'width:160px; height:20px;',
            'rule' => 'notEmpty',
            'label' => false,
            'type' => 'text',
            'value' => empty($search_user['account'])?'':$search_user['account'],
        ));?>
   </td>
    <div class="search_div_button">
        <?php echo $this->Form->end(__(LANG_SEARCH));?>
    </div>

    <div class="search_table">
        <table>
            <tr>
                <th style="width: 80px"><?php echo 'char_id'?></th>
                <th style="width: 80px"><?php echo __(LANG_ACCOUNT_NAME)?></th>
                <th style="width: 80px"><?php echo __(LANG_NICKNAME)?></th>
                <th style="width: 80px"><?php echo __(LANG_CLASS)?></th>
                <th style="width: 80px"><?php echo __(LANG_LV)?></th>
                <th style="width: 80px"><?php echo 'CRYSTAL'?></th>
                <th style="width: 80px"><?php echo __(LANG_GOLD)?></th>

                <th style="width: 80px"><?php echo __(LANG_FRIEND_POINT)?></th>
                <th style="width: 80px"><?php echo __(LANG_STAMINA)?></th>
                <th style="width: 80px"><?php echo __('채팅금지')?></th>
                <th style="width: 80px"><?php echo __('계정정지')?></th>
            </tr>
            <?php if(!empty($user_list)) {?>
                <?php $num = ''; $count = count($user_list);?>
                <?php $num2 = ''; $count = count($user_character_list);?>
                <?php $char_id = '';?>
                <?php $char_usn = '';?>
                <?php foreach($user_list as $num => $value) {
                   foreach($user_character_list as $num2 => $value2) { ?>
                    <tr>
                        <td class="user_link">
                            <?php $char_id = $value2['tbl_character']['_id'];
                            $char_usn = $value2['tbl_character']['usn'];
                            $chat_ban_type = $value['tbl_account']['chatBanned'];
                            $ban_type = $value['tbl_account']['banned'];
                            echo $char_id ; ?>
                        </td>
                        <td class="user_link">
                            <?php echo $value['tbl_account']['account']; ?>
                        </td>
                         <td class="user_link">
                            <?php echo $value2['tbl_character']['nick_name']; ?>
                         </td>
                        <td class="user_link">
                            <?php echo $value2['tbl_character']['char_class']?>
                        </td>
                        <td class="user_link">
                            <?php echo  $value2['tbl_character']['level'] ;?>
                        </td>
                        <td class="user_link">
                            <?php echo $value['tbl_account']['crystal']?>
                        </td>
                        <td class="user_link">
                            <?php echo  $value2['tbl_character']['gold'] ;?>
                        </td>
                        <td class="user_link">
                            <?php echo  $value2['tbl_character']['friend_point'] ;?>
                        </td>
                        <td class="user_link">
                            <?php echo  $value2['tbl_character']['stamina'] ;?>
                        </td>
                        <td class="user_link">
                             <?php echo $this->Form->create('user_chat_ban',array('action' => 'ban_chat'))?>
                                    <?php echo $this->Form->input('char_usn', array(
                                        'type'=>'hidden',
                                        'id'=>'char_usn',
                                        'name'=>'char_usn',
                                        'value'=>$char_usn,
                                        'label'=>false,
                                        'div'=>false
                                     ));?>
                                     <?php echo $this->Form->input('chat_ban_type', array(
                                         'type'=>'hidden',
                                         'id'=>'chat_ban_type',
                                         'name'=>'chat_ban_type',
                                         'value'=>$chat_ban_type,
                                         'label'=>false,
                                         'div'=>false
                                      ));?>
                              <?php
                              if ($chat_ban_type)
                                echo $this->Form->end('채팅금지 해지');
                              else
                                echo $this->Form->end('채팅금지');
                              ?>
                        </td>
                        <td class="user_link">
                             <?php echo $this->Form->create('user_ban',array('action' => 'ban_account'))?>
                                    <?php echo $this->Form->input('char_usn', array(
                                        'type'=>'hidden',
                                        'id'=>'char_usn',
                                        'name'=>'char_usn',
                                        'value'=>$char_usn,
                                        'label'=>false,
                                        'div'=>false
                                     ));?>
                                     <?php echo $this->Form->input('ban_type', array(
                                         'type'=>'hidden',
                                         'id'=>'ban_type',
                                         'name'=>'ban_type',
                                         'value'=>$ban_type,
                                         'label'=>false,
                                         'div'=>false
                                      ));?>
                              <?php
                              if ($ban_type)
                                echo $this->Form->end('계정정지 해지');
                              else
                                echo $this->Form->end('계정정지');
                              ?>
                        </td>
                    </tr>
                <?php }
                }?>
            <?php }?>
        </table>

<div class="tales_stats_menu">
    <ui>
        <li class="tales_of_deonia"><?php echo '이 유저에게 편지를 보내기'?></li>
    </ui>
</div>
         <?php echo $this->Form->create('send_message',array('action' => 'send_private_message'))?></div>
                <?php echo $this->Form->input('message_info', array(
                    'rule' => 'notEmpty',
                    'label' => false,
                    'type' => 'text'
                ));?>
           </td>
            <?php echo $this->Form->input('char_usn', array(
               'type'=>'hidden',
               'id'=>'char_usn',
               'name'=>'char_usn',
               'value'=>empty($char_id)?'':$char_id,
               'label'=>false,
               'div'=>false
            ));?>
            <div class="search_div_button">
                <?php echo $this->Form->end('편지보내기');?>
            </div>
        <?php if(!empty($err_msg)) {?>
            <p class="info_empty_text tales_of_deonia_err"><?php echo __($err_msg)?></p>
        <?php }?>
    </div>
</div>


